{--
    Should compile if type aliases work more like macros like in
    http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#type-synonyms
-}
module tests.comp.Issue21 where

--- Lens type
type Lens' s a = forall f. Functor f => (a -> f a) -> s -> f s

--- You can write a forall (including overloading) in a type synonym, thus:
type Discard a = forall b. Show b => a -> b -> (a, String)



f :: Discard c
-- f :: forall b c. Show b => c -> b -> (c, String)
f x y = (x, show y)

g :: Discard Int -> (Int,String)    -- A rank-2 type
-- g :: (forall b . Show b => Int -> b -> (Int, String)) -> (Int, String) 
g f = f 3 true

h = g f


main _ = println h